{{extend '../layout/main.html'}}

{{block name="css"}}
<style>
  .card-header {
    position: relative;
  }

  .card-header .add {
    position: absolute;
    right: 10px;
    top: 5px;
  }
</style>
{{/block}}

{{block name="js"}}
<script src="/socket.io/socket.io.js"></script>
<script>
  let client = io('/')

  $('.sendmsg').click(function () {
    let msg = $('#msg').val()
    client.send(msg)
    $.alert('发送成功')
    $('#msg').val('')
  })
</script>
{{/block}}

{{block name="content"}}
<!--页面主要内容-->
<main class="lyear-layout-content">

  <div class="container-fluid">

    <div class="row">
      <div class="col-md-12">
        <div class="card">
          <div class="card-header">
            <h3>发布新消息</h3>
            <a href="/message/index" class="btn btn-primary add">返回列表</a>
          </div>
          <div class="card-body">
            <form class="form-horizontal" action="/message/send" method="post">
              <div class="form-group">
                <label class="col-xs-12" for="desn">站内信息内容：</label>
                <div class="col-xs-12">
                  <textarea class="form-control" name="msg" id="msg" rows="6" placeholder="内容.."></textarea>
                </div>
              </div>
              <hr>
              <div class="form-group">
                <div class="col-xs-12">
                  <button class="btn btn-primary sendmsg" type="button">发送站内信息</button>
                </div>
              </div>
            </form>

          </div>
        </div>
      </div>

    </div>

</main>
<!--End 页面主要内容-->
{{/block}}